#include<string>
#include <iostream>

/*通过租房来学习代理模式
    代理模式:代理者与被代理者有相同的接口，但是是加强版的更加详细
*/


class RentHouse{
public:
    virtual void rent()=0;
};

class Landlord:public RentHouse{
public:
    void rent() override{
        std::cout<<"房东出租房间"<<std::endl;
    }
};

class Intermediary:public Landlord{
public:
    void rent() override{
        std::cout<<"中介发布公告"<<std::endl;
        std::cout<<"中介带人看房"<<std::endl;
        _landlord.rent();
        std::cout<<"中介完成交易"<<std::endl;
    };
private:
    Landlord _landlord;
};
int main()
{
    Intermediary intermediary;
    intermediary.rent();
    return 0;
}